var t = require;
var e = module;
var o = exports;
var n =
        (this && this.__extends) ||
        (function () {
            var t = function (e, o) {
                return (t =
                    Object.setPrototypeOf ||
                    ({__proto__: []} instanceof Array &&
                        function (t, e) {
                            t.__proto__ = e;
                        }) ||
                    function (t, e) {
                        for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
                    })(e, o);
            };
            return function (e, o) {
                function n() {
                    this.constructor = e;
                }
                t(e, o), (e.prototype = null === o ? Object.create(o) : ((n.prototype = o.prototype), new n()));
            };
        })(),
    r =
        (this && this.__decorate) ||
        function (t, e, o, n) {
            var r,
                a = arguments.length,
                i = a < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(t, e, o, n);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (r = t[s]) && (i = (a < 3 ? r(i) : a > 3 ? r(e, o, i) : r(e, o)) || i);
            return a > 3 && i && Object.defineProperty(e, o, i), i;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var a = t("Util"),
    i = cc._decorator,
    s = i.ccclass,
    c =
        (i.property,
        (function (t) {
            function e() {
                return (null !== t && t.apply(this, arguments)) || this;
            }
            return (
                n(e, t),
                (e.prototype.onLoad = function () {
                    var t = new cc.Node();
                    (t.y = -20),
                        this.node.addChild(t),
                        (this.lable = t.addComponent(cc.Label)),
                        (this.lable.fontSize = 32);
                }),
                (e.prototype.setData = function (t, e, o) {
                    var n = this;
                    if (((this.lable.font = o), e > t)) {
                        this.lable.node.color = cc.Color.GREEN;
                        var r = e - t;
                        cc.tween(this.lable.node)
                            .delay(0.6)
                            .call(function () {
                                (n.lable.string = "+" + r),
                                    cc
                                        .tween(n.lable.node)
                                        .by(0.5, {y: 50})
                                        .call(function () {
                                            n.lable.node.destroy();
                                        })
                                        .start();
                            })
                            .start();
                    } else if (t > e) {
                        this.lable.node.color = cc.Color.RED;
                        var i = t - e;
                        (this.lable.string = "-" + i),
                            cc
                                .tween(this.lable.node)
                                .by(0.5, {y: -50})
                                .call(function () {
                                    n.lable.node.destroy();
                                })
                                .start();
                    } else
                        a.scheduleOnce(function () {
                            n.lable.node.destroy();
                        });
                }),
                (e = r([s], e))
            );
        })(cc.Component));
o.default = c;
